<%@ page import="weaver.general.Util" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="java.util.*" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%-- <%@ page import="jdk.nashorn.internal.parser.JSONParser" %> --%>
<%@ page import="net.sf.json.JSONArray" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
  /*如果没有遇见你，我将会是在哪里*/
    /**                      /
     * 获取上次月报内容  wangjie/
     -----------------------*/
    //获取当前用户id
    String loginid = null;
    Cookie[] cookies = request.getCookies();
    for (Cookie cookie:
         cookies) {
        if ("loginidweaver".equals(cookie.getName())){
            loginid = cookie.getValue();
        }
    }
    if (loginid == null) {
        response.getWriter().write("loginid is null");
        return;
    }

//    String sql = "select * from uf_jbzxxx_dt1 dt1 where dt1.mainid = (select top(1) main.id from uf_jbzxxx main,uf_jbzxxx_dt1 dt1 where main.id = dt1.mainid and modedatacreater = '"+loginid+"' order by modedatacreatedate,modedatacreatetime desc)";
    String sql = "select *,(Select CONVERT(varchar(100), GETDATE(), 23)) as now from uf_jbzxxx main,uf_jbzxxx_dt1 dt1 where main.id = dt1.mainid and modedatacreater = '"+loginid+"' order by modedatacreatedate,modedatacreatetime desc";

    rs.executeSql(sql);
    List<Map<String,String>> list  = new ArrayList<Map<String,String>>();
    while (rs.next()){
        String xh = Util.null2String(rs.getString("xh"));
        String xm = Util.null2String(rs.getString("xm"));
        String sfzh = Util.null2String(rs.getString("sfzh"));
        String nl = Util.null2String(rs.getString("nl"));
        String xb = Util.null2String(rs.getString("xb"));
        String xl = Util.null2String(rs.getString("xl"));
        String zzmm = Util.null2String(rs.getString("zzmm"));
        String rysf = Util.null2String(rs.getString("rysf"));
        String zwlb = Util.null2String(rs.getString("zwlb"));
        String zcdj = Util.null2String(rs.getString("zcdj"));
        String gzdw = Util.null2String(rs.getString("gzdw"));
        String gzgw = Util.null2String(rs.getString("gzgw"));
        String lxdh = Util.null2String(rs.getString("lxdh"));
        String gzzt = Util.null2String(rs.getString("gzzt"));
        //获取流程创建时间和当前时间
        String now = Util.null2String(rs.getString("now"));
        String modedatacreatedate = Util.null2String(rs.getString("modedatacreatedate"));
        Map<String, String> bean = new HashMap<String, String>();
        bean.put("xh",xh);
        bean.put("xm",xm);
        bean.put("sfzh",sfzh);
        bean.put("nl",nl);
        bean.put("xb",xb);
        bean.put("xh",xh);
        bean.put("xl",xl);
        bean.put("zzmm",zzmm);
        bean.put("rysf",rysf);
        bean.put("zwlb",zwlb);
        bean.put("zcdj",zcdj);
        bean.put("gzdw",gzdw);
        bean.put("gzgw",gzgw);
        bean.put("lxdh",lxdh);
        bean.put("gzzt",gzzt);
        //流程创建时间和现在时间
        bean.put("now",now);
        bean.put("modedatacreatedate",modedatacreatedate);
        list.add(bean);
    }

    //转换json
    JSONArray objects = JSONArray.fromObject(list);
    PrintWriter writer = response.getWriter();
    writer.write(objects.toString());




%>